package server.socket.bean;

import server.socket.handler.ClientHandler;

import java.io.IOException;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.List;

public abstract class EServer {
    protected List<ClientHandler> clients;
    protected ServerSocket serverSocket;

    public EServer(int port) throws IOException {
        clients = new ArrayList<>();
        serverSocket = new ServerSocket(port);
    }

    public abstract void update();

    /**
     * 删除连接的client
     *
     * @param client
     */
    public void remove(Object client) {
        clients.remove(client);
    }

    /**
     * 获取已连接的clients名单
     *
     * @return
     */
    public List<ClientHandler> getClients() {
        return clients;
    }

}
